package com.gym.controller;

import com.github.pagehelper.PageInfo;
import com.gym.pojo.Employee;
import com.gym.pojo.Lose;
import com.gym.service.LoseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@RestController
public class LoseController {
    @Resource
    private LoseService loseService;

    @RequestMapping("/select")
    public Map<String,Object> selectlose(String losename,int page,int limit){
        PageInfo<Lose> pageInfo = (PageInfo<Lose>) loseService.select(losename,page,limit);
        Map<String,Object> result = new HashMap<>();
        result.put("code",0);
        result.put("msg","");
        result.put("count",pageInfo.getTotal());
        result.put("data",pageInfo.getList());
        return result;
    }
    @RequestMapping("/selectlosename")
    public Lose selectlosename(String losename){
        return loseService.selectlosename(losename);
    }
    @RequestMapping("/insert")
    public boolean insertlose(Lose lose){
        return loseService.insert(lose);
    }
    @RequestMapping("/update")
    public boolean updatelose(Lose lose){
        return loseService.update(lose);
    }
    @RequestMapping("/delete")
    public boolean deletelose(int loseId){
        return loseService.delete(loseId);
    }

}
